<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
let arrPers = [
  {
    name: '小明',
    age: 18,
    sex: '男',
    score: 80,
  },
  {
    name: '小红',
    age: 20,
    sex: '女',
    score: 92,
  },
  {
    name: '小刚',
    age: 19,
    sex: '男',
    score: 78,
  },
  {
    name: '小丽',
    age: 21,
    sex: '女',
    score: 95,
  }
];

//找出年龄最大的人并打印名字
let maxAge = -1;
let maxAgeName = '';
for (let person of arrPers) {
  if (person.age > maxAge) {
    maxAge = person.age;
    maxAgeName = person.name;
  }
}
console.log('年龄最大的人是：' + maxAgeName);

// 为每个人的分数增加5分（最高100分），然后打印整个数组
for (let person of arrPers) {
  person.score = Math.min(person.score + 5, 100);
}
console.log('加分后的数组：');
console.log(arrPers);
    </script>
</body>
</html>